<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/taglib.jsp" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <title>聚人消费网络有限公司</title>
    <!--[if IE 8]>
    <script type='text/javascript' src='${ctx}/js/excanvas.js'></script>
    <link rel="stylesheet" href="${ctx}/css/IEfix.css" type="text/css" media="screen" />
    <![endif]-->

    <!--[if IE 7]>
    <script type='text/javascript' src='${ctx}/js/excanvas.js'></script>
    <link rel="stylesheet" href="${ctx}/css/IEfix.css" type="text/css" media="screen" />
    <![endif]-->
    <link type="text/css" href="${ctx}/css/style.css" rel="stylesheet"/>
    <!-- the layout css file -->
    <link type="text/css" href="${ctx}/css/jquery.cleditor.css" rel="stylesheet"/>

    <script type='text/javascript' src='${ctx}/js/jquery-1.4.2.min.js'></script>
    <!-- jquery library -->
    <script type='text/javascript' src='${ctx}/js/jquery-ui-1.8.5.custom.min.js'></script>
    <!-- jquery UI -->
    <script type='text/javascript' src='${ctx}/js/cufon-yui.js'></script>
    <!-- Cufon font replacement -->
    <script type='text/javascript' src='${ctx}/js/colaboratelight_400.font.js'></script>
    <!-- the Colaborate Light font -->
    <script type='text/javascript' src='${ctx}/js/easytooltip.js'></script>
    <!-- element tooltips -->
    <script type='text/javascript' src='${ctx}/js/jquery.tablesorter.min.js'></script>
    <!-- tablesorter -->

    <script type="text/javascript" src="${ctx}/js/jquery.validate.js"></script>
    <script type='text/javascript' src='${ctx}/js/visualize.jquery.js'></script>
    <!-- visualize plugin for graphs / statistics -->
    <script type='text/javascript' src='${ctx}/js/iphone-style-checkboxes.js'></script>
    <!-- iphone like checkboxes -->
    <script type='text/javascript' src='${ctx}/js/jquery.cleditor.min.js'></script>
    <!-- wysiwyg editor -->

    <script type='text/javascript' src='${ctx}/js/custom.js'></script>
    <!-- the "make them work" script -->

    <script type="text/javascript">

        function showDialog() {
            jQuery('#dialog').dialog({
                autoOpen:false,
                width:650,
                buttons:{
                    "提交":function () {

                        var name = jQuery("#name").val();
                        if (name == "") {
                            jQuery("#nameTip").attr("class", "validate_error");
                        } else {
                            document.getElementById("frm").submit();
                            jQuery(this).dialog("close");
                        }
                    },
                    "取消":function () {
                        jQuery(this).dialog("close");
                    }
                }
            });
            jQuery('#dialog').dialog('open');
        }

        function showDialog1(name , id) {
            jQuery("#name1").val(name);
            jQuery("#id").val(id);
            jQuery('#dialog1').dialog({
                autoOpen:false,
                width:650,
                buttons:{
                    "提交":function () {

                        var name = jQuery("#name1").val();
                        if (name == "") {
                            jQuery("#nameTip1").attr("class", "validate_error");
                        } else {
                            document.getElementById("frm1").submit();
                            jQuery(this).dialog("close");
                        }
                    },
                    "取消":function () {
                        jQuery(this).dialog("close");
                    }
                }
            });
            jQuery('#dialog1').dialog('open');
        }
        function showAction(obj) {
            var li = jQuery(obj);
            if (li.find("p").length == 4) {
                var p = li.find("p").get(3);
                p.style.display = "block";
            }
        }
        function hideAction(obj) {
            var li = jQuery(obj);
            if (li.find("p").length == 4) {
                var p = li.find("p").get(3);
                p.style.display = "none";
            }
        }
    </script>
    <meta charset="UTF-8">
</head>

<body>

<div id="container">
    <div id="bgwrap">

        <div id="primary_left">

            <div id="logo">
                <a href="#" title="Dashboard"><img src="${ctx}/assets/LogoMaker.png" width="220" height="48" alt=""/></a>
            </div>
            <!-- logo end -->

            <div id="menu"> <!-- navigation menu -->
                <ul>
                    <li><a href="${ctx}/forward/index/html" class="dashboard"><img
                            src="${ctx}/assets/icons/small_icons_3/dashboard.png" alt=""/><span
                            class="current">首页</span></a></li>
                    <li><a href="${ctx}/user/userManager" class="dashboard"><img
                            src="${ctx}/assets/icons/small_icons_3/users.png" alt=""/><span
                            class="current">用户管理</span></a></li>
                    <li class="current"><a href="${ctx}/album" class="dashboard"><img
                            src="${ctx}/assets/icons/small_icons_3/media.png" alt=""/><span
                            class="current">产品图片管理</span></a></li>
                    <li class="fade_hover tooltip" title="返回网站主页">
                        <a href="${ctx}">
                            <img src="${ctx}/assets/icons/dashboard/back.png" alt=""/>
                            <span>返回网站主页</span>
                        </a>
                    </li>
                </ul>
            </div>
            <!-- navigation menu end -->
        </div>
        <!-- sidebar end -->
        <div id="primary_right">
            <div class="inner" style="width: 78%;">


                <ul class="dash">


                    <li class="fade_hover tooltip" title="添加图库">
                        <a href="#" onclick="showDialog();">
                            <img src="${ctx}/assets/icons/dashboard/photos.png" alt=""/>
                            <span>添加图片库</span>
                        </a>
                    </li>

                    <%--<li class="fade_hover tooltip" title="Website Statistics">--%>
                    <%--<a href="#">--%>
                    <%--<img src="${ctx}/assets/icons/dashboard/81.png" alt=""/>--%>
                    <%--<span>统计</span>--%>
                    <%--</a>--%>
                    <%--</li>--%>


                    <li class="fade_hover tooltip " title="退出系统">
                        <a href="${ctx}/user/logout">
                            <img src="${ctx}/assets/icons/dashboard/118.png" alt=""/>
                            <span>注销</span>
                        </a>
                    </li>
                </ul>
                <!-- end dashboard items -->

                <div id="dialog" title="添加图库" style="display: none;">
                    <form action="${ctx}/album/addAction" method="post" id="frm">
                        <input name="token" type="hidden" value="${token}">
                        <fieldset>
                            <p>
                                <label>图库名称：</label>
                                <input class="sf" name="name" type="text" id="name"
                                       value=""/>
                                <span class="field_desc" id="nameTip">请输入图库名称</span>
                            </p>
                        </fieldset>
                    </form>
                </div>

                <div id="dialog1" title="修改图库" style="display: none;">
                    <form action="${ctx}/album/updateAction" method="post" id="frm1">
                         <input id="id" name="id" type="hidden">
                         <input name="token" type="hidden" value="${token}">
                        <fieldset>
                            <p>
                                <label>图库名称：</label>
                                <input class="sf" name="name" type="text" id="name1"
                                       value=""/>
                                <span class="field_desc" id="nameTip1">请输入图库名称</span>
                            </p>
                        </fieldset>
                    </form>
                </div>
                <div class="clearboth"></div>
                <c:if test="${success!=null}">
                    <div class="notification success">
                        <span></span>

                        <div class="text">
                            <p><strong>成功!</strong> ${success}</p>
                        </div>
                    </div>
                </c:if>
                <c:if test="${error!=null}">
                    <div class="notification error">
                        <span></span>

                        <div class="text">
                            <p><strong>错误!</strong> ${error}</p>
                        </div>
                    </div>
                </c:if>
                <hr/>
                <span style="font-size: 28px;font-weight: bold;">图库管理</span>
                <div style="width: 100%;float: left;margin-top: 15px;">
                    <div style="overflow: hidden;">
                        <ul style="list-style-type: none;">
                            <c:if test="${albums!=null}">
                                <c:forEach items="${albums}" var="album">
                                    <c:set var="url" scope="page" value="${ctx}/assets/no_photo_s.png"/>
                                    <li style="width: 112px;height: 180px;float: left;position: relative;margin-right: 26px;"
                                        onmouseout="hideAction(this)" onmouseover="showAction(this);">
                                        <p style="  background-image: url('${ctx}/assets/album_bg.jpg');background-repeat: no-repeat;background-color: transparent;width: 106px;height: 110px;text-align: center;padding: 6px;padding-right: 0px;padding-bottom: 0px;padding-left: 6px;margin-bottom: 7px;">
                                            <c:forEach var="image" items="${album.imagesList}" begin="0" end="0">
                                                <c:set var="url" value="${ctx}/${image.url}"/>
                                            </c:forEach>
                                            <img onclick="window.location.href ='${ctx}/image/${album.id}'"
                                                 height="100" width="96"
                                                 style="vertical-align: middle;margin-left: -6px;cursor: pointer"
                                                 src="${url}">
                                        </p>

                                        <p style="padding: 0px;margin: 0px;">
                                            <span>${album.name}</span>
                                        </p>

                                        <p style="padding: 0px;margin: 0px;color: #999999">
                                            <span>共${fn:length(album.imagesList)}张</span>
                                        </p>

                                        <p style="padding: 0px;margin: 0px;display: none;">
                                            <span><a href="javascript:showDialog1('${album.name}' , '${album.id}')" style="text-decoration: none;color: green;">编辑</a>
                                                <%--<a href="#" style="text-decoration: none;color: green;">删除</a>--%>
                                            </span>
                                        </p>
                                    </li>
                                </c:forEach>
                            </c:if>
                        </ul>
                    </div>
                </div>


            </div>
            <!-- inner -->
        </div>
        <!-- primary_right -->
    </div>
    <!-- bgwrap -->
</div>
<!-- container -->
</body>
</html>
